iconview: Use gdk_window_new_child()
authorBenjamin Otte <otte@redhat.com>
Mon, 17 Oct 2016 22:20:02 +0000 (00:20 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 17 Oct 2016 22:22:35 +0000 (00:22 +0200)
gtk/gtkiconview.c

index 444143b1d75ffb9d48cc95e2ee52ac96ba8674dd..4e828b2b71a48993b05cbd0912c856f124558621 100644 (file)
@@ -1267,48 +1267,32 @@ gtk_icon_view_realize (GtkWidget *widget)
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
   GtkAllocation allocation;
   GdkWindow *window;
-  GdkWindowAttr attributes;
-  gint attributes_mask;
 
   gtk_widget_set_realized (widget, TRUE);
 
   gtk_widget_get_allocation (widget, &allocation);
 
   /* Make the main, clipping window */
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.wclass = GDK_INPUT_OUTPUT;
-  attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
-
-  attributes_mask = GDK_WA_X | GDK_WA_Y;
-
-  window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                           &attributes, attributes_mask);
+  window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
+                                 GDK_VISIBILITY_NOTIFY_MASK,
+                                 &allocation);
   gtk_widget_set_window (widget, window);
   gtk_widget_register_window (widget, window);
 
-  gtk_widget_get_allocation (widget, &allocation);
-
   /* Make the window for the icon view */
-  attributes.x = 0;
-  attributes.y = 0;
-  attributes.width = MAX (icon_view->priv->width, allocation.width);
-  attributes.height = MAX (icon_view->priv->height, allocation.height);
-  attributes.event_mask = (GDK_SCROLL_MASK |
-                           GDK_SMOOTH_SCROLL_MASK |
-                           GDK_POINTER_MOTION_MASK |
-                           GDK_LEAVE_NOTIFY_MASK |
-                           GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_KEY_PRESS_MASK |
-                           GDK_KEY_RELEASE_MASK) |
-    gtk_widget_get_events (widget);
-  
-  icon_view->priv->bin_window = gdk_window_new (window,
-                                               &attributes, attributes_mask);
+  icon_view->priv->bin_window = gdk_window_new_child (window,
+                                                      gtk_widget_get_events (widget)
+                                                      | GDK_SCROLL_MASK
+                                                      | GDK_SMOOTH_SCROLL_MASK
+                                                      | GDK_POINTER_MOTION_MASK
+                                                      | GDK_LEAVE_NOTIFY_MASK
+                                                      | GDK_BUTTON_PRESS_MASK
+                                                      | GDK_BUTTON_RELEASE_MASK
+                                                      | GDK_KEY_PRESS_MASK
+                                                      | GDK_KEY_RELEASE_MASK,
+                                                      &(GdkRectangle) { 0, 0,
+                                                      MAX (icon_view->priv->width, allocation.width),
+                                                      MAX (icon_view->priv->height, allocation.height)});
   gtk_widget_register_window (widget, icon_view->priv->bin_window);
   gdk_window_show (icon_view->priv->bin_window);
 }